/*****************************************************************
 * this program performs that it prints all the prime numbers
 * between 800 and 1000 which ended with digit 7.
 *
 * date:	2015|11|23
 * author:	laishaofa@gmail.com
 *****************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

int isPrimeNumber(int n){
    assert(n>=1);
    if(n==2)
        return 1;

    int i=0;
    for(i=2; i<sqrt(n)+1; i++){
        if(n%i ==0)
            return 0;
    }
    return 1;
}

int isEndWith7(int n){
    return (n%10==7);
}

int main()
{
    int i = 0;
    for(i=800; i< 1000; i++){
        if(isPrimeNumber(i) && isEndWith7(i))
            printf("%d\n",i);
    }
    return 0;
}
